package com.mystudy.dataStructure.collections;

import com.mystudy.dataStructure.tree.BST;

/**
 * @author 周志龙
 * @Email 15216876513@163.com
 * @Date on 2019/7/28 21:10
 * @Description 基于二分搜索树的集合
 */
public class BSTSet<E extends Comparable> implements Set<E> {
    private BST<E> bst;

    public BSTSet() {
        this.bst = new BST<>();
    }

    @Override
    public void add(E e) {
        bst.add(e);
    }

    @Override
    public void remove(E e) {
        bst.remove(e);
    }

    @Override
    public boolean contains(E e) {
        return bst.contains(e);
    }

    @Override
    public int getSize() {
        return bst.size();
    }

    @Override
    public boolean isEmpty() {
        return bst.isEmpty();
    }

    @Override
    public String toString() {
        return bst.toString();
    }
}
